package com.cqyc.shop.services;

import java.util.List;

import com.cqyc.shop.comm.commException;
import com.cqyc.shop.dao.OrdersDao;
import com.cqyc.shop.domain.Orders;

public class OrdersServices {

	private OrdersDao ordersDao =  new OrdersDao();
 	public void save(Orders orders) {
		// TODO 保存商品信息到订单信息的数据库中
 		List<Orders> orders2 = ordersDao.findPager(orders);
 		if(orders2.size()>=3) {
 			throw new commException("同样的产品可以添加购买数来买哟！！");
 		}else {
 			ordersDao.save(orders);
		}
		
	}
	public List<Orders> findPager(String  usercode) {
		// TODO   将数据从订单表中查询出来
		
		return ordersDao.findPager(usercode);
	}
	public void delete(Integer idd) {
		// TODO 将数据从订单表中删除掉
		ordersDao.delete(idd);
	}

}
